﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Forms.Core;
using Umbraco.Forms.Data.Storage;


namespace ContourStrikesAgain.FieldTypes
{
    public class CompareTextbox: FieldType
    {
        private Controls.CompareTextBox dtxt;

        [Umbraco.Forms.Core.Attributes.Setting("Second caption", description = "second caption")]
        public string SecondCaption { get; set; }

        public CompareTextbox()
        {
            this.Id = new Guid("2843177F-FD46-49AA-9282-3E2986121832");
            this.Name = "Compare textbox";
            this.Description = "compare";

            this.Icon = "textfield.png";
            this.DataType = FieldDataType.String;
            dtxt = new Controls.CompareTextBox();
          

            _value = new List<object>();
        }


        private List<Object> _value = new List<object>();
        public override List<object> Values
        {
            get
            {
                _value.Add(dtxt.Value);

                return _value;
            }
            set
            {
                _value = value;
            }
        }

        public override System.Web.UI.WebControls.WebControl Editor
        {
            get
            {
                dtxt.SecondCaption = SecondCaption;

                return dtxt;
            }
            set
            {
                base.Editor = value;
            }
        }

        public override string RenderPreview()
        {
            return "Preview not available";
        }

        public override string RenderPreviewWithPrevalues(List<object> prevalues)
        {
            return RenderPreview();
        }

        public override bool SupportsRegex
        {
            get
            {
                return true;
            }
        }


    }
}